/**
 * 
 */
package com.gragra.distances.tests;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import com.gragra.distances.InverseLogTimes;
import com.gragra.distances.InverseLogTimesFactory;
import com.gragra.sampling.vector.VectorStructure;
/**
 * @author Christoph Teichmann
 * created May 6, 2013 10:55:18 AM
 * @version 0.1
 */
public class TestInverseLogTimes
{
	/**
	 * 
	 */
	private InverseLogTimes ilt;
	/**
	 *
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception
	{
		InverseLogTimesFactory iltf = new InverseLogTimesFactory(1.0);
		ilt = (InverseLogTimes) iltf.createInstance();
	}
	/**
	 * Test method for {@link com.gragra.distances.InverseLogTimes#set()}.
	 */
	@Test
	public final void testSet()
	{
		assertTrue(ilt.empty());
		ilt.add(new VectorStructure(3, new double[] {2,4,5}, new int[][] {{2,1},{2,2},{3,4}},2));
		assertFalse(ilt.empty());
		ilt.add(new VectorStructure(3, new double[] {5,7,9}, new int[][] {{2,1},{2,2},{3,4}},2));
		assertFalse(ilt.empty());
		ilt.set();
		assertEquals(19.650650899540963,ilt.getDistance(new VectorStructure(3, new double[] {5,7,4}, new int[][] {{2,1},{2,2},{3,5}},2)),0.0000000001);
	}
}
